package org.principle.LawofDemeter.Install_good;

import java.util.Random;

public class Wizard {
	private Random rand = new Random(System.currentTimeMillis());

	private int first() {
		System.out.println("执行第一个方法...");
		return rand.nextInt();
	}

	private int second() {
		System.out.println("执行第二个方法...");
		return rand.nextInt();
	}

	private int third() {
		System.out.println("执行第三个方法...");
		return rand.nextInt();
	}
	
	public void installWizard(Wizard wizard) {
		int first = wizard.first();
		if (first > 50) {
			int second = wizard.second();
			if (second > 50) {
				int third = wizard.third();
				if (third > 50) {
					wizard.first();
				}
			}
		}
	}
}
